/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sccpa;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author admin
 */
@Entity
@Table(name = "composicao_familiar", catalog = "db_projeto_araca", schema = "")
@NamedQueries({
    @NamedQuery(name = "ComposicaoFamiliar.findAll", query = "SELECT c FROM ComposicaoFamiliar c"),
    @NamedQuery(name = "ComposicaoFamiliar.findByCodComposicaoFamiliar", query = "SELECT c FROM ComposicaoFamiliar c WHERE c.codComposicaoFamiliar = :codComposicaoFamiliar"),
    @NamedQuery(name = "ComposicaoFamiliar.findByCodAluno", query = "SELECT c FROM ComposicaoFamiliar c WHERE c.codAluno = :codAluno"),
    @NamedQuery(name = "ComposicaoFamiliar.findByCodPessoa", query = "SELECT c FROM ComposicaoFamiliar c WHERE c.codPessoa = :codPessoa"),
    @NamedQuery(name = "ComposicaoFamiliar.findByParentesco", query = "SELECT c FROM ComposicaoFamiliar c WHERE c.parentesco = :parentesco"),
    @NamedQuery(name = "ComposicaoFamiliar.findByResponsavel", query = "SELECT c FROM ComposicaoFamiliar c WHERE c.responsavel = :responsavel"),
    @NamedQuery(name = "ComposicaoFamiliar.findByRendaFamiliarAntes", query = "SELECT c FROM ComposicaoFamiliar c WHERE c.rendaFamiliarAntes = :rendaFamiliarAntes"),
    @NamedQuery(name = "ComposicaoFamiliar.findByRendaFamiliarDepois", query = "SELECT c FROM ComposicaoFamiliar c WHERE c.rendaFamiliarDepois = :rendaFamiliarDepois"),
    @NamedQuery(name = "ComposicaoFamiliar.findByNumeroPessoasFamilia", query = "SELECT c FROM ComposicaoFamiliar c WHERE c.numeroPessoasFamilia = :numeroPessoasFamilia")})
public class ComposicaoFamiliar implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "COD_COMPOSICAO_FAMILIAR")
    private Integer codComposicaoFamiliar;
    @JoinColumn(name="COD_ALUNO",referencedColumnName="COD_ALUNO")
    @ManyToOne
    private Alunos codAluno;
    @JoinColumn(name="COD_PESSOA",referencedColumnName="COD_PESSOA")
    @ManyToOne
    private Pessoas codPessoa;
    @Basic(optional = false)
    @Column(name = "PARENTESCO")
    private String parentesco;
    @Basic(optional = false)
    @Column(name = "RESPONSAVEL")
    private String responsavel;
    @Lob
    @Column(name = "HISTORICO_FAMILIAR")
    private String historicoFamiliar;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "RENDA_FAMILIAR_ANTES")
    private Float rendaFamiliarAntes;
    @Column(name = "RENDA_FAMILIAR_DEPOIS")
    private Float rendaFamiliarDepois;
    @Column(name = "NUMERO_PESSOAS_FAMILIA")
    private Integer numeroPessoasFamilia;

    public ComposicaoFamiliar() {
    }

    public ComposicaoFamiliar(Integer codComposicaoFamiliar) {
        this.codComposicaoFamiliar = codComposicaoFamiliar;
    }

    public ComposicaoFamiliar(Integer codComposicaoFamiliar, Alunos codAluno, Pessoas codPessoa, String parentesco, String responsavel) {
        this.codComposicaoFamiliar = codComposicaoFamiliar;
        this.codAluno = codAluno;
        this.codPessoa = codPessoa;
        this.parentesco = parentesco;
        this.responsavel = responsavel;
    }

    public Integer getCodComposicaoFamiliar() {
        return codComposicaoFamiliar;
    }

    public void setCodComposicaoFamiliar(Integer codComposicaoFamiliar) {
        Integer oldCodComposicaoFamiliar = this.codComposicaoFamiliar;
        this.codComposicaoFamiliar = codComposicaoFamiliar;
        changeSupport.firePropertyChange("codComposicaoFamiliar", oldCodComposicaoFamiliar, codComposicaoFamiliar);
    }

    public Alunos getCodAluno() {
        return codAluno;
    }

    public void setCodAluno(Alunos codAluno) {
        Alunos oldCodAluno = this.codAluno;
        this.codAluno = codAluno;
        changeSupport.firePropertyChange("codAluno", oldCodAluno, codAluno);
    }

    public Pessoas getCodPessoa() {
        return codPessoa;
    }

    public void setCodPessoa(Pessoas codPessoa) {
        Pessoas oldCodPessoa = this.codPessoa;
        this.codPessoa = codPessoa;
        changeSupport.firePropertyChange("codPessoa", oldCodPessoa, codPessoa);
    }

    public String getParentesco() {
        return parentesco;
    }

    public void setParentesco(String parentesco) {
        String oldParentesco = this.parentesco;
        this.parentesco = parentesco;
        changeSupport.firePropertyChange("parentesco", oldParentesco, parentesco);
    }

    public String getResponsavel() {
        return responsavel;
    }

    public void setResponsavel(String responsavel) {
        String oldResponsavel = this.responsavel;
        this.responsavel = responsavel;
        changeSupport.firePropertyChange("responsavel", oldResponsavel, responsavel);
    }

    public String getHistoricoFamiliar() {
        return historicoFamiliar;
    }

    public void setHistoricoFamiliar(String historicoFamiliar) {
        String oldHistoricoFamiliar = this.historicoFamiliar;
        this.historicoFamiliar = historicoFamiliar;
        changeSupport.firePropertyChange("historicoFamiliar", oldHistoricoFamiliar, historicoFamiliar);
    }

    public Float getRendaFamiliarAntes() {
        return rendaFamiliarAntes;
    }

    public void setRendaFamiliarAntes(Float rendaFamiliarAntes) {
        Float oldRendaFamiliarAntes = this.rendaFamiliarAntes;
        this.rendaFamiliarAntes = rendaFamiliarAntes;
        changeSupport.firePropertyChange("rendaFamiliarAntes", oldRendaFamiliarAntes, rendaFamiliarAntes);
    }

    public Float getRendaFamiliarDepois() {
        return rendaFamiliarDepois;
    }

    public void setRendaFamiliarDepois(Float rendaFamiliarDepois) {
        Float oldRendaFamiliarDepois = this.rendaFamiliarDepois;
        this.rendaFamiliarDepois = rendaFamiliarDepois;
        changeSupport.firePropertyChange("rendaFamiliarDepois", oldRendaFamiliarDepois, rendaFamiliarDepois);
    }

    public Integer getNumeroPessoasFamilia() {
        return numeroPessoasFamilia;
    }

    public void setNumeroPessoasFamilia(Integer numeroPessoasFamilia) {
        Integer oldNumeroPessoasFamilia = this.numeroPessoasFamilia;
        this.numeroPessoasFamilia = numeroPessoasFamilia;
        changeSupport.firePropertyChange("numeroPessoasFamilia", oldNumeroPessoasFamilia, numeroPessoasFamilia);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codComposicaoFamiliar != null ? codComposicaoFamiliar.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ComposicaoFamiliar)) {
            return false;
        }
        ComposicaoFamiliar other = (ComposicaoFamiliar) object;
        if ((this.codComposicaoFamiliar == null && other.codComposicaoFamiliar != null) || (this.codComposicaoFamiliar != null && !this.codComposicaoFamiliar.equals(other.codComposicaoFamiliar))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "sccpa.ComposicaoFamiliar[ codComposicaoFamiliar=" + codComposicaoFamiliar + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
